
		/**
	 * 设置cookie
	 * @param {string} name  键名
	 * @param {string} value 键值
	 * @param {integer} days cookie周期
	 */
	exports.setCookie = function(name,value,time) {
				function getsec(str){
			   var str1=str.substring(1,str.length)*1; 
			   var str2=str.substring(0,1); 
			   if (str2=="s")
			   { 
			        return str1*1000; 
			   }
			   else if (str2=="h")
			   { 
			       return str1*60*60*1000; 
			   }
			   else if (str2=="d")
			   { 
			       return str1*24*60*60*1000; 
			   } 
			} 
			//这是有设定过期时间的使用示例： 
			//s20是代表20秒 
			//h是指小时，如12小时则是：h12 
			//d是天数，30天则：d30 

	    if (time) {
	        var date = new Date();
	        date.setTime(date.getTime()+getsec(time));
	        var expires = "; expires="+date.toGMTString();
	    }else{
	        var expires = "";
	    }
	    document.cookie = name+"="+value+expires+"; path=/";
	},
	 
	// 获取cookie
	exports.getCookie = function(name) {
	    var nameEQ = name + "=";
	    var ca = document.cookie.split(';');
	    for(var i=0;i < ca.length;i++) {
	        var c = ca[i];
	        while (c.charAt(0)==' '){
	         c = c.substring(1,c.length);
	        }
	        if (c.indexOf(nameEQ) == 0){
	         return c.substring(nameEQ.length,c.length);
	        }
	    }
	    return null;
	},
	 
	// 删除cookie
	exports.deleteCookie = function(name) {
	    setCookie(name,"",-1);
	}
	
